package com.example.langchain4j.utils;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.resource.ResourceUtil;

import java.nio.charset.StandardCharsets;


public class TemplateUtils {

    public static String loadCaseApprovalTemplate(String fileName) {
        try {
            // 方式1: 从resources目录加载
            String jsonContent = ResourceUtil.readUtf8Str(fileName);
            return jsonContent;
        } catch (Exception e) {
            // 方式2: 如果resources下没有，尝试从文件系统加载
            try {
                String jsonContent = FileUtil.readString(fileName, StandardCharsets.UTF_8);
                return jsonContent;
            } catch (Exception ex) {
                throw new RuntimeException("无法加载立案审批表.json模板: " + ex.getMessage());
            }
        }
    }
}